home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Mousebroken 1.0.1 / source / Modules source ƒ / Circle mouse + click / Circle module ][.c next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.1 KB  |  75 lines  |  [TEXT/KAHL]

  1. /* Circle Mouse ][ -- a Mousebroken mouse module */
  2. /* written 12/93 by Mark Pilgrim */
  3. /* This module placed in the public domain. */
  4.  
  5. #include "Retrace.h"
  6. #include "GestaltEQU.h"
  7.  
  8. extern Boolean CrsrNew : 0x8CE;
  9. extern Point mTemp : 0x828;
  10. extern Point RawMouse : 0x82C;
  11.  
  12. unsigned long    me;
  13. int                vx,vy;
  14. Boolean            xIncreasing, yIncreasing;
  15.  
  16. #define RADIUS        5        /* actual radius is (1+2+...+(RADIUS-1))+(RADIUS/2) */
  17. #define TIMEDELAY    1
  18.  
  19. void header(void);
  20. void main(void);
  21.  
  22. void header(void)
  23. {
  24.     asm
  25.     {
  26.         dc.l    0
  27.         move.l a0, d0
  28.         lea header, a0
  29.         jmp main
  30.     }
  31. }
  32.  
  33. #include "SetUpA4.h"
  34.  
  35. void main(void)
  36. {
  37.     VBLTask*        myVBL;
  38.     
  39.     RememberA0();
  40.     SetUpA4();
  41.     
  42.     asm
  43.     {
  44.         move.l d0, myVBL
  45.     }
  46.     
  47.     if (me != 'MMdl')
  48.     {
  49.         me = 'MMdl';
  50.         vx=RADIUS;
  51.         vy=0;
  52.         xIncreasing=FALSE;
  53.         yIncreasing=TRUE;
  54.     }
  55.     
  56.     if (Button())
  57.     {
  58.         RawMouse.h+=vx;
  59.         mTemp.h+=vx;
  60.         RawMouse.v+=vy;
  61.         mTemp.v+=vy;
  62.         
  63.         vx+=xIncreasing ? 1 : -1;
  64.         vy+=yIncreasing ? 1 : -1;
  65.         
  66.         xIncreasing=(vx==RADIUS) ? FALSE : (vx==-RADIUS) ? TRUE : xIncreasing;
  67.         yIncreasing=(vy==RADIUS) ? FALSE : (vy==-RADIUS) ? TRUE : yIncreasing;
  68.         
  69.         CrsrNew = TRUE;
  70.     }
  71.     
  72.     myVBL->vblCount = TIMEDELAY;
  73.     RestoreA4();
  74. }
  75.